#include<stdio.h>
#include<stdlib.h>
#include<windows.h> 
void main()
{
	
	int i,j;
	int x=0;
	int y=5;
	int velocity_x=1;
	int velocity_y=1;
	
	int bottom = 10;
	int right = 20;
	

	
	while(1)
	{
y = y + velocity_y;
		
		x = x + velocity_x; 
		system("cls");

		for( i=1; i<=bottom; i++)
		{
			for(j=1; j<=right; j++)
			{
				if(i==y && j==x)
					printf("0");
			
				else if(j == right)
					printf("|"); 
			
				else if(j == 1)
					printf("|"); 
			
				else if(i == bottom)
					printf("_");
		
				else
					printf(" ");
			}

		printf("\n");

		}
		
		if(y>bottom || y<1)
		{
			velocity_y = -velocity_y;
			printf("\a");
		}

		if(x>right || x<1)
		{
			velocity_x = -velocity_x; 
			printf("\a");
		}
		Sleep(150);
	}
}
